import { _decorator, Component, Node } from 'cc';
import { BaseManager } from './BaseManager';
const { ccclass, property } = _decorator;

@ccclass('StorageManager')
export class StorageManager extends BaseManager {

    managerName: string = '储存管理器'

    init(): void {
        
    }

    /**
     * 设置本地存储
     * @param key 键
     * @param value 值
     */
    setLocalItem(key: string, value: string) {
        localStorage.setItem(key, value)
    }

    /**
     * 获取本地存储
     * @param key 键
     * @returns 值
     */
    getLocalItem(key: string): string | null {
        return localStorage.getItem(key)
    }

    /**
     * 移除本地存储
     * @param key 键
     */
    removeLocalItem(key: string) {
        localStorage.removeItem(key)
    }

    /** 清除本地存储 */
    clearLocalItem() {
        localStorage.clear()
    }
}


